<template>
  <div class="myfootprint">
    <div class="titledesc">
      <el-link type="success"><span>我的足迹</span></el-link>
      <div class="operation">
        <el-button plain type="success" @click="operate">操作</el-button>
        <el-checkbox label="全选" v-if="chckedShow" v-model="checkedAll" @change="gocheckedAll()" style="margin: 0 10px"></el-checkbox>
        <el-checkbox label="全选" disabled v-else style="margin: 0 10px"></el-checkbox>
        <el-button plain type="danger" style="margin-right: 20px">删除</el-button>
      </div>
    </div>
    <!--无限滚动-->
    <div v-infinite-scroll="load" class="infinite-list" style="overflow: auto">
      <div v-for="(i,index) in 3">
        <!--分割条-->
        <el-divider border-style="dashed" content-position="center"><span style="font-size: 20px">2022-9-{{17-index}}</span></el-divider>
        <div class="box">
          <div class="goods-detail-item" v-for="(item,index) in footprintList" :key="index">
            <div class="check" :class="{active:item.checked}" @click="checked(item)" v-show="chckedShow">
              <el-icon style="transform: rotate(58deg);"><Check /></el-icon>
            </div>
            <div class="goods-detail-item-top">
              <img :src="item.imgsrc" alt="图片走丢了">
            </div>
            <!--商品信息-->
            <div class="goods-info">
              <!--              内容，名字-->
              <div class="title">
                <a >
                  真的爱你
                </a>
              </div>
              <div class="operate">
                <a >
                  删除足迹
                </a>
                <a>
                  查看详情
                </a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {ref,reactive} from 'vue'

    const count = ref(0)

    const load = () => {
      console.log('--到底部自动执行回调方法--');
    }

    let footprintList = reactive([
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
      {
        imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
        desc:'真的爱你',
        checked:false
      },
    ])
    const checked = (item) => {
      console.log('我被点击了');
      item.checked = !item.checked
    }
    let chckedShow = ref(false)

    const operate = () => {
      console.log(chckedShow.value);
      chckedShow.value = !chckedShow.value
    }

    let checkedAll = ref(false)

    const gocheckedAll = () => {

      checkedAll = checkedAll !== true;

      for (let favoriteListElement of footprintList) {
        favoriteListElement.checked = checkedAll
      }
    }
</script>

<style scoped lang="scss">
  .myfootprint {
    .titledesc {
      border-bottom: 1px solid gainsboro;
      display: flex;
      align-items: center;
      justify-content: space-between;
      span {
        font-size: 20px;
        display: block;
        padding: 10px 0;
      }
    }
  }
  .goods-detail-item {
    display: inline-block;
    position: relative;
    overflow: hidden;
    width: 230px;
    text-align: center;
    height: 320px;
    margin: 10px;
    border: 1px solid gainsboro;
    /*box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);*/
    border-radius: 10px;
    &:hover {
      transition: all 0.3s linear;
      box-shadow:0 0 20px #cccccc;
    }
    .goods-detail-item-top {
      overflow: hidden;
      height: 228px;
      img {
        border-radius: 10px 10px;
        width: 100%;
      }
    }
  }
  /*.goods-detail-item:hover {*/
  /*  border: 1px solid #C0C4CC;*/
  /*  padding: 9px;*/
  /*}*/

  .price {
    color: orangered;
    font-weight: bolder;
    margin: 10px;
  }
  .title {
    font-size: 12px;
    margin-top: 20px;
  }
  .title a:hover {
    color: orangered;
  }
  .operate {
    margin-top: 20px;
    display: flex;
    align-items: center;
    a {
      width: 50%;
      height: 30px;
      line-height: 30px;
      font-size: 14px;
      color: #999999;
      cursor: pointer;
    }
    a:nth-of-type(1) {
      border-right: 1px solid antiquewhite;
    }
  }

  /*无限滚动样式*/
  .infinite-list {
    height: 600px;
    padding: 0;
    margin: 0;
    list-style: none;
    .box {
      display: flex;
      flex-wrap: wrap;
      padding: 0 118px;
    }
    .infinite-list-item {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 50px;
      background: var(--el-color-primary-light-9);
      margin: 10px;
      color: var(--el-color-primary);
    }
  }
  .infinite-list .infinite-list-item + .list-item {
    margin-top: 10px;
  }
  /*定义滚动条高宽及背景
 高宽分别对应横竖滚动条的尺寸*/
  .infinite-list::-webkit-scrollbar
  {
    width:16px;
    height:16px;
    background-color:#F5F5F5;
  }
  /*定义滚动条轨道
 内阴影+圆角*/
  .infinite-list::-webkit-scrollbar-track
  {
    -webkit-box-shadow:inset 0 0 6px rgba(255, 255, 255, 0.3);
    border-radius:10px;
  }
  /*定义滑块
 内阴影+圆角*/
  .infinite-list::-webkit-scrollbar-thumb
  {
    border-radius: 10px;
    background-color: antiquewhite;
  }
  .check {
    transform: rotate(-50deg);
    position: absolute;
    font-size: 40px;
    color: #cccccc;
    /* left: -80px; */
    top: 6px;
    left: -73px;
    opacity: 0.8;
    width: 200px;
    background: #ece3d4;
  }
  .active {
    background: orangered;
    color: white;
  }
</style>
